/*
 * @Author: silence silence9685@163.com
 * @Date: 2023-04-23 10:15:22
 * @LastEditors: silence silence9685@163.com
 * @LastEditTime: 2023-07-21 15:30:48
 * @FilePath: \lenercom_bluetooth_app\lib\pages\Mine\Feedback\FeedbackPage.dart
 * @Description: 意见反馈
 */
import 'package:ems_neutral_app/pages/Mine/Language/SilLocalizations/SilLocalizations.dart';
import 'package:ems_neutral_app/utils/router/ARouter.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../base/SilScaffold.dart';
import '../../../common/module/IdeaFeedbackWidget/IdeaFeedbackWidget.dart';
import '../../../common/widgets/cubitWidget/SubmitBtn.dart';
import '../../../utils/color/ColorUtils.dart';
import 'package:sil_base_widget_package/sil_base_widget_package.dart';

import '../MinePage/MineController.dart';

class FeedbackPage extends StatefulWidget {
  const FeedbackPage({Key? key}) : super(key: key);

  @override
  State<FeedbackPage> createState() => _FeedbackPageState();
}

class _FeedbackPageState extends State<FeedbackPage> {
  MineController _mineController = Get.put(MineController());
  String? _content;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return SilScaffold(
      title: LangOf(context)?.opinion?.feedoack,
      body: mainWidget(),
    );
  }

  mainWidget() {
    return Container(
        margin: EdgeInsets.only(top: 40.w, left: 10.w, right: 10.w),
        child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
          SilText(
            LangOf(context)?.opinion?.suggestion,
            color: ColorUtils.color_font_main,
            fontSize: 16.w,
          ),
          Padding(padding: EdgeInsets.only(top: 10.w)),
          Container(
            height: 180.w,
            padding: EdgeInsets.symmetric(horizontal: 10.w),
            decoration: BoxDecoration(
              color: ColorUtils.hexColor('#242424'),
              borderRadius: BorderRadius.circular(10.w),
            ),
            child: SilTextInput(
              hint: LangOf(context)?.opinion?.opplace,
              maxLength: 1000,
              onChanged: (str) {
                _content = str;
              },
            ),
          ),

          /// 提交
          Container(
            alignment: Alignment.center,
            child: SubmitBtn(
              margin: EdgeInsets.only(top: 60.w),
              title: LangOf(context)?.business?.submit,
              onTapFunc: saveSetHandler,
            ),
          )
        ]));
  }

  /// 提交
  saveSetHandler() {
    _mineController.requestFeedback(
        context: context,
        content: _content,
        successHandler: (p0) => ARoute.pop(context));
  }
}
